VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmINV500 
   BackColor       =   &H00800000&
   Caption         =   "INV500"
   ClientHeight    =   7980
   ClientLeft      =   435
   ClientTop       =   555
   ClientWidth     =   11055
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   7980
   ScaleWidth      =   11055
   Begin MSAdodcLib.Adodc Adodc7 
      Height          =   330
      Left            =   8160
      Top             =   390
      Visible         =   0   'False
      Width           =   2010
      _ExtentX        =   3545
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "7.Lot No"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc6 
      Height          =   330
      Left            =   6840
      Top             =   0
      Visible         =   0   'False
      Width           =   1830
      _ExtentX        =   3228
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "6.POL"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame FrameTransaction 
      BackColor       =   &H00800000&
      BorderStyle     =   0  'None
      Height          =   1215
      Left            =   210
      TabIndex        =   34
      Top             =   810
      Width           =   10485
      Begin MSDataListLib.DataCombo cboTHWHC 
         Bindings        =   "frmINV500.frx":0000
         Height          =   315
         Left            =   1665
         TabIndex        =   48
         Top             =   735
         Visible         =   0   'False
         Width           =   2835
         _ExtentX        =   5001
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "WMDSC"
         BoundColumn     =   "WMWHC"
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo cboTHTTC 
         Bindings        =   "frmINV500.frx":0015
         Height          =   315
         Left            =   7530
         TabIndex        =   47
         Top             =   795
         Visible         =   0   'False
         Width           =   2910
         _ExtentX        =   5133
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "TCDSC"
         BoundColumn     =   "TCTTC"
         Text            =   ""
      End
      Begin VB.TextBox txtTHDOC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1620
         TabIndex        =   41
         Top             =   390
         Width           =   1284
      End
      Begin VB.TextBox txtTHDTE 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   7515
         TabIndex        =   40
         Top             =   420
         Width           =   1284
      End
      Begin VB.TextBox txtTHWHC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1650
         TabIndex        =   39
         Top             =   735
         Width           =   510
      End
      Begin VB.TextBox txtWMDSC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   2190
         Locked          =   -1  'True
         TabIndex        =   38
         Top             =   720
         Width           =   2250
      End
      Begin VB.TextBox txtTHTTC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   7530
         TabIndex        =   36
         Top             =   795
         Width           =   456
      End
      Begin VB.TextBox txtTCDSC 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   8055
         Locked          =   -1  'True
         TabIndex        =   37
         Top             =   810
         Width           =   2340
      End
      Begin VB.TextBox txtTHTID 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   4515
         Locked          =   -1  'True
         TabIndex        =   35
         Top             =   15
         Width           =   1170
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Document No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   2
         Left            =   15
         TabIndex        =   46
         Top             =   465
         Width           =   1395
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Date"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   3
         Left            =   5775
         TabIndex        =   45
         Top             =   495
         Width           =   525
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Ware House code"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   4
         Left            =   0
         TabIndex        =   44
         Top             =   780
         Width           =   1560
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Transaction code"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   5
         Left            =   5775
         TabIndex        =   43
         Top             =   810
         Width           =   1770
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Transaction No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00E0E0E0&
         Height          =   255
         Index           =   16
         Left            =   3060
         TabIndex        =   42
         Top             =   60
         Width           =   1395
      End
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   360
      Left            =   4920
      Top             =   120
      Visible         =   0   'False
      Width           =   2025
      _ExtentX        =   3572
      _ExtentY        =   635
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "2.WareHouse"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdReview 
      Caption         =   "&Review Document"
      Height          =   432
      Left            =   420
      TabIndex        =   31
      Top             =   7500
      Width           =   1092
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   456
      Left            =   6090
      TabIndex        =   19
      Top             =   7500
      Width           =   1044
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "&Cancel"
      Height          =   456
      Left            =   4980
      TabIndex        =   18
      Top             =   7500
      Width           =   1080
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "&Save"
      Height          =   456
      Left            =   3885
      TabIndex        =   17
      Top             =   7515
      Width           =   1080
   End
   Begin VB.CommandButton cmdAddNew 
      Caption         =   "New &Document"
      Height          =   456
      Left            =   1560
      TabIndex        =   16
      Top             =   7500
      Width           =   1152
   End
   Begin VB.CommandButton cmdNewItem 
      Caption         =   "New &Item"
      Height          =   456
      Left            =   2745
      TabIndex        =   15
      Top             =   7500
      Width           =   1128
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   345
      Left            =   2520
      Top             =   0
      Visible         =   0   'False
      Width           =   2190
      _ExtentX        =   3863
      _ExtentY        =   609
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "1.ITH"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame FrameTransactionLines 
      BackColor       =   &H00800000&
      BorderStyle     =   0  'None
      Height          =   2724
      Left            =   390
      TabIndex        =   13
      Top             =   4635
      Width           =   10320
      Begin MSDataGridLib.DataGrid grdITH 
         Bindings        =   "frmINV500.frx":002A
         Height          =   2775
         Left            =   30
         TabIndex        =   14
         Top             =   -15
         Width           =   10335
         _ExtentX        =   18230
         _ExtentY        =   4895
         _Version        =   393216
         AllowUpdate     =   -1  'True
         BackColor       =   -2147483624
         ForeColor       =   8388736
         HeadLines       =   3
         RowHeight       =   21
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "VNI-Times"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   16
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "THTID"
            Caption         =   "ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1036
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "THDOC"
            Caption         =   "Doc No"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1036
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "THITN"
            Caption         =   "Item"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "IMITD"
            Caption         =   "Description"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "THTSQ"
            Caption         =   "Seq. No"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "THLTN"
            Caption         =   "Lot.No"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "THCVN"
            Caption         =   "Cust / Vendor"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column08 
            DataField       =   "Name"
            Caption         =   "Cust/Vendor Name"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column09 
            DataField       =   "THREF"
            Caption         =   "Ref.No"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column10 
            DataField       =   "THQTY"
            Caption         =   "Qty"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column11 
            DataField       =   "THWGT"
            Caption         =   "WGT"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column12 
            DataField       =   "THCST"
            Caption         =   "Value"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column13 
            DataField       =   "THREM"
            Caption         =   "Remarks"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column14 
            DataField       =   "UserName"
            Caption         =   "Staff name"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1036
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column15 
            DataField       =   "THLDT"
            Caption         =   "Update time"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1036
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            ScrollGroup     =   3
            BeginProperty Column00 
               ColumnWidth     =   14.74
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   524.976
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   30.047
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   764.787
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
               ColumnWidth     =   1709.858
            EndProperty
            BeginProperty Column05 
               Locked          =   -1  'True
               ColumnWidth     =   929.764
            EndProperty
            BeginProperty Column06 
               Locked          =   -1  'True
               ColumnWidth     =   1019.906
            EndProperty
            BeginProperty Column07 
               Locked          =   -1  'True
               ColumnWidth     =   750.047
            EndProperty
            BeginProperty Column08 
               Locked          =   -1  'True
               ColumnWidth     =   1665.071
            EndProperty
            BeginProperty Column09 
               Locked          =   -1  'True
               ColumnWidth     =   989.858
            EndProperty
            BeginProperty Column10 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   959.811
            EndProperty
            BeginProperty Column11 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   810.142
            EndProperty
            BeginProperty Column12 
               Alignment       =   1
               Locked          =   -1  'True
               ColumnWidth     =   870.236
            EndProperty
            BeginProperty Column13 
               Locked          =   -1  'True
               ColumnWidth     =   1725.165
            EndProperty
            BeginProperty Column14 
            EndProperty
            BeginProperty Column15 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Frame FrameItemTransactionDetail 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   2136
      Left            =   345
      TabIndex        =   2
      Top             =   2055
      Width           =   10344
      Begin MSDataListLib.DataCombo cboTHLTN 
         Bindings        =   "frmINV500.frx":003F
         Height          =   315
         Left            =   8760
         TabIndex        =   50
         Top             =   30
         Visible         =   0   'False
         Width           =   1470
         _ExtentX        =   2593
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "LMLOT"
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo cboTHREF 
         Bindings        =   "frmINV500.frx":0054
         Height          =   315
         Left            =   6615
         TabIndex        =   49
         Top             =   450
         Visible         =   0   'False
         Width           =   1230
         _ExtentX        =   2170
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "OLPON"
         BoundColumn     =   "OLPON"
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo cboTHCVN 
         Bindings        =   "frmINV500.frx":0069
         Height          =   315
         Left            =   1485
         TabIndex        =   33
         Top             =   390
         Visible         =   0   'False
         Width           =   3420
         _ExtentX        =   6033
         _ExtentY        =   556
         _Version        =   393216
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo cboTHITN 
         Bindings        =   "frmINV500.frx":007E
         Height          =   315
         Left            =   1500
         TabIndex        =   32
         Top             =   30
         Visible         =   0   'False
         Width           =   4125
         _ExtentX        =   7276
         _ExtentY        =   556
         _Version        =   393216
         ListField       =   "IMITD"
         BoundColumn     =   "IMITN"
         Text            =   ""
      End
      Begin VB.TextBox txtTHCST 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   8850
         TabIndex        =   30
         Top             =   840
         Width           =   1275
      End
      Begin VB.TextBox txtTHREM 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   912
         Left            =   1512
         MultiLine       =   -1  'True
         TabIndex        =   29
         Top             =   1176
         Width           =   8595
      End
      Begin VB.TextBox txtTHWGT 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6615
         TabIndex        =   28
         Top             =   840
         Width           =   876
      End
      Begin VB.TextBox txtTHQTY 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1500
         TabIndex        =   27
         Top             =   804
         Width           =   885
      End
      Begin VB.TextBox txtTHREF 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6615
         TabIndex        =   26
         Top             =   450
         Width           =   900
      End
      Begin VB.TextBox txtName 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   2490
         Locked          =   -1  'True
         TabIndex        =   25
         Top             =   405
         Width           =   2415
      End
      Begin VB.TextBox txtTHCVN 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1500
         TabIndex        =   24
         Top             =   390
         Width           =   900
      End
      Begin VB.TextBox txtTHLTN 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   8790
         TabIndex        =   23
         Top             =   60
         Width           =   1230
      End
      Begin VB.TextBox txtTHTSQ 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   6615
         TabIndex        =   22
         Top             =   75
         Visible         =   0   'False
         Width           =   876
      End
      Begin VB.TextBox txtIMITD 
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   3045
         Locked          =   -1  'True
         TabIndex        =   21
         Top             =   30
         Width           =   2550
      End
      Begin VB.TextBox txtTHITN 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   288
         Left            =   1500
         TabIndex        =   20
         Top             =   45
         Width           =   1425
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Remark"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   216
         Index           =   14
         Left            =   192
         TabIndex        =   11
         Top             =   1224
         Width           =   840
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Cost"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   13
         Left            =   8055
         TabIndex        =   10
         Top             =   870
         Width           =   585
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Weight"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   12
         Left            =   5760
         TabIndex        =   9
         Top             =   900
         Width           =   825
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Quantity"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   11
         Left            =   210
         TabIndex        =   8
         Top             =   825
         Width           =   1185
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "PO"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   10
         Left            =   5790
         TabIndex        =   7
         Top             =   495
         Width           =   390
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Cust/Vendor"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   216
         Index           =   9
         Left            =   204
         TabIndex        =   6
         Top             =   432
         Width           =   1224
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Lot No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   8
         Left            =   7950
         TabIndex        =   5
         Top             =   60
         Width           =   705
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "SEQ No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   255
         Index           =   7
         Left            =   5760
         TabIndex        =   4
         Top             =   120
         Visible         =   0   'False
         Width           =   765
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Item No"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   252
         Index           =   6
         Left            =   204
         TabIndex        =   3
         Top             =   60
         Width           =   756
      End
   End
   Begin MSAdodcLib.Adodc Adodc5 
      Height          =   330
      Left            =   9375
      Top             =   45
      Visible         =   0   'False
      Width           =   1860
      _ExtentX        =   3281
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "5.Transaction"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc4 
      Height          =   345
      Left            =   8235
      Top             =   60
      Visible         =   0   'False
      Width           =   1980
      _ExtentX        =   3493
      _ExtentY        =   609
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "4.Cust"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc3 
      Height          =   360
      Left            =   6120
      Top             =   480
      Visible         =   0   'False
      Width           =   1965
      _ExtentX        =   3466
      _ExtentY        =   635
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "3.IIM"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Document lines"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   255
      Index           =   15
      Left            =   45
      TabIndex        =   12
      Top             =   4365
      Width           =   1725
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Inventory Transaction Entry"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   16.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   540
      Index           =   1
      Left            =   2070
      TabIndex        =   1
      Top             =   210
      Width           =   5820
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "INV500"
      BeginProperty Font 
         Name            =   "VNI-Present"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   516
      Index           =   0
      Left            =   84
      TabIndex        =   0
      Top             =   -24
      Width           =   1752
   End
End
Attribute VB_Name = "frmINV500"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Dim NewTrans As Byte

Private Sub cboTHCVN_Click(Area As Integer)
    If Area = 2 Then
        txtTHCVN = cboTHCVN.BoundText
        txtName = cboTHCVN.Text
        cboTHCVN.Visible = False
        If txtTHREF.Visible Then txtTHREF.SetFocus
    End If
End Sub

Private Sub cboTHITN_Click(Area As Integer)
    If Area = 2 Then
        txtTHITN = cboTHITN.BoundText
        txtIMITD = Find("IIM", "IMITD", " WHERE IMITN='" & cboTHITN.BoundText & "'")
        cboTHITN.Visible = False
        FieldDel = "LMRID"
        DelStatus = "LZ"
        sql = "Select LMLOT from ILM where " & FieldDel & _
        " <>'" & DelStatus & "' AND LMITN='" & txtTHITN & "' Group by LMLOT"
        Adodc7.ConnectionString = ConnectString
        Adodc7.ConnectionTimeout = 10
        Adodc7.CommandType = adCmdText
        Adodc7.RecordSource = sql
        Adodc7.Refresh
        txtTHLTN.Visible = Find("IIM", "IMLOT", " WHERE IMITN='" & cboTHITN.BoundText & "'")
       ' txtTHLTN.Visible = Find("IIM", "IMLOT", " WHERE IMITN='" & cboTHITN.BoundText & "'")
        If txtTHLTN.Visible Then txtTHLTN.SetFocus
        If txtTHREF.Visible Then 'Have PO
            Adodc6.RecordSource = "Select OLPON from POL Where OLITN='" & _
            txtTHITN & "' AND OLSTT <> '7' group by OLPON"
            Adodc6.Refresh
        End If
    End If
End Sub

Private Sub cboTHLTN_Click(Area As Integer)
If Area = 2 Then
    txtTHLTN = cboTHLTN.Text
    cboTHLTN.Visible = False
    If txtTHCVN.Visible Then txtTHCVN.SetFocus
End If
End Sub

Private Sub cboTHREF_Click(Area As Integer)
If Area = 2 Then
    txtTHREF = cboTHREF.Text
    cboTHREF.Visible = False
    txtTHQTY.SetFocus
End If
End Sub

Private Sub cboTHTTC_Click(Area As Integer)
If Area = 2 Then
    txtTHTTC = cboTHTTC.BoundText
    txtTCDSC = cboTHTTC.Text
    
    txtTHCVN.Visible = True
    txtName.Visible = True
    Dim RecITC As Recordset
    Set RecITC = DBconn.Execute("Select * from ITC where TCTTC='" & txtTHTTC & "'")
    Adodc4.ConnectionString = ConnectString
    Adodc4.ConnectionTimeout = 10
    Adodc4.CommandType = adCmdText
    If RecITC!TCEFR Then
        txtTHREF.Visible = True
        FieldDel = "VMRID"
        DelStatus = "VZ"
        Adodc4.RecordSource = "Select * from AVM where " & FieldDel & " <>'" & DelStatus & "'"
        Adodc4.Refresh
        lbl(9).Caption = "Vendor"
        cboTHCVN.Text = ""
        cboTHCVN.BoundColumn = "VMVDN"
        cboTHCVN.ListField = "VMNME"
        Adodc1.RecordSource = "SELECT ITH.*,AVM.VMNME As Name ,Users.Name as UserName, IIM.IMITD " & _
            " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
            " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
            " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
            " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
            " Users.UserName = ITH.THLUS" & _
            " WHERE THDOC='" & txtTHDOC & "' Order by THTID"
        Adodc1.Refresh
    Else
        txtTHREF.Visible = False
        cboTHCVN.Text = ""
        If RecITC!TCEFI Then
            FieldDel = "CMRID"
            DelStatus = "CZ"
            lbl(9).Caption = "Customer"
            Adodc4.RecordSource = "Select * from RCM where " & FieldDel & " <>'" & DelStatus & "'"
            Adodc4.Refresh
            cboTHCVN.BoundColumn = "CMCNO"
            cboTHCVN.ListField = "CMNME"
            Adodc1.RecordSource = "SELECT ITH.*,RCM.CMNME As Name ,Users.Name as UserName, IIM.IMITD " & _
                " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
                " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
                " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
                " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
                " Users.UserName = ITH.THLUS" & _
                " WHERE THDOC='" & txtTHDOC & "' Order by THTID"
            Adodc1.Refresh
        Else
'            cboTHCVN.Visible = False
            txtTHCVN.Visible = False
            txtName.Visible = False
        End If
        
    End If
   ' Adodc4.Refresh
    cboTHTTC.Visible = False
    txtTHITN.SetFocus
End If
End Sub

Private Sub cboTHWHC_Click(Area As Integer)
If Area = 2 Then
    txtTHWHC = cboTHWHC.BoundText
    txtWMDSC = cboTHWHC.Text
    cboTHWHC.Visible = False
    txtTHTTC.SetFocus

End If
End Sub

Private Sub cmdAddnew_Click()
NewTrans = True
ISADDING = True
ISEDITING = True
WriteToScreen
ButtonStatus
txtTHDOC.SetFocus
End Sub

Private Sub cmdCancel_Click()
NewTrans = False
ISADDING = False
ISEDITING = False
WriteToScreen
ButtonStatus
End Sub

Private Sub cmdexit_Click()
Unload frmINV500
End Sub
Sub WriteToScreen()
If NewTrans Then
    txtTHDOC = ""
    txtTHWHC = ""
    txtWMDSC = ""
    txtTHDTE = WorkingDate
    txtTHTTC = ""
    txtTCDSC = ""
End If

If ISADDING Then
   txtTHITN = ""
   txtIMITD = ""
   txtTHCVN = ""
   txtName = ""
   txtTHTSQ = 0
   txtTHLTN = ""
   txtTHREF = ""
   txtTHQTY = 0
   txtTHWGT = 0
   txtTHCST = 0
   txtTHREM = ""
   StrCV = ""
   
Else
    If txtTHTID <> "" Then
        Dim recITH As Recordset
        Set recITH = DBconn.Execute("select * from ITH where THTID=" & txtTHTID)
        With recITH
            txtTHTID = !THTID
            txtTHDOC = !THDOC
            txtTHWHC = !THWHC
            txtWMDSC = Find("IWM", "WMDSC", "Where WMWHC='" & !THWHC & "'")
            txtTHDTE = !THDTE
            txtTHTTC = !THTTC
            txtTCDSC = Find("ITC", "TCDSC", "Where TCTTC='" & !THTTC & "'")
            txtTHITN = !THITN
            txtIMITD = Find("IIM", "IMITD", "Where IMITN='" & txtTHITN & "'")
            txtTHCVN = !THCVN
            If IsNull(!THTSQ) Then
                txtTHTSQ = ""
            Else
                txtTHTSQ = !THTSQ
            End If
            txtTHLTN = !THLTN
             If IsNull(!THTSQ) Then
                txtTHREF = ""
            Else
                txtTHREF = !THREF
            End If
            
            txtTHQTY = !THQTY
            txtTHWGT = !THWGT
            
            txtTHCST = !THCST
             If IsNull(!THTSQ) Then
                txtTHREM = ""
            Else
                txtTHREM = !THREM
            End If
            
        End With
    End If
End If
If txtTHDOC <> "" Then
    If Find("ITC", "TCDSC", " Where TCTTC='" & txtTHTTC & "' and TCEFR<>0") <> "" Then
        txtName = Find("AVM", "VMNME", "where VMVDN='" & txtTHCVN & "'")
        StrCV = ",AVM.VMNME As Name"
        FieldDel = "VMRID"
        DelStatus = "VZ"
        Adodc4.RecordSource = "Select * from AVM where " & FieldDel & " <>'" & DelStatus & "'"
        Adodc4.Refresh
        cboTHCVN.BoundColumn = "VMVDN"
        cboTHCVN.ListField = "VMNME"
    Else
        txtName = Find("RCM", "CMNME", "where CMCNO='" & txtTHCVN & "'")
        StrCV = ",RCM.CMNME As Name"
        FieldDel = "CMRID"
        DelStatus = "CZ"
        Adodc4.RecordSource = "Select * from RCM where " & FieldDel & " <>'" & DelStatus & "'"
        Adodc4.Refresh
        cboTHCVN.BoundColumn = "CMCNO"
        cboTHCVN.ListField = "CMNME"
    End If
End If
Adodc1.RecordSource = "SELECT ITH.*" & StrCV & " ,Users.Name as UserName, IIM.IMITD " & _
    " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
    " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
    " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
    " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
    " Users.UserName = ITH.THLUS" & _
    " WHERE THDOC='" & txtTHDOC & "' and THTTC='" & txtTHTTC & _
    "' AND day(THDTE)=" & Day(txtTHDTE) & " and month(THDTE)=" & Month(txtTHDTE) & " AND year(THDTE)=" & Year(txtTHDTE) & _
    " Order by THTID"

Adodc1.Refresh
End Sub

Private Sub cmdNewItem_Click()
'NewTrans = True
ISADDING = True
ISEDITING = True
WriteToScreen
ButtonStatus
End Sub

Private Sub cmdReview_Click()
frmReview.Tag = "INV500"
frmReview.Show 1
ISEDITING = False
ISADDING = False
If frmReview.Tag <> "" Then
    txtTHDOC = frmReview.GridList.Columns(1)
    txtTHDTE = frmReview.GridList.Columns(2)
    txtTHTTC = frmReview.GridList.Columns(4)
    Unload frmReview
    Dim recITH As Recordset
    Set recITH = DBconn.Execute("Select * from ITH where THDOC='" & txtTHDOC & "' and THTTC='" & txtTHTTC & _
    "' AND day(THDTE)=" & Day(txtTHDTE) & " and month(THDTE)=" & Month(txtTHDTE) & " AND year(THDTE)=" & Year(txtTHDTE))
    txtTHTID = recITH!THTID
    WriteToScreen
End If
End Sub

Private Sub cmdSave_Click()
If ValidInput Then
    WriteToFile
    NewTrans = False
    ISADDING = False
    ISEDITING = False
    WriteToScreen
    ButtonStatus
End If
End Sub

Private Sub Form_Load()
ISADDING = False
ISEDITING = False
SELECTROW = 1
OpenFile
End Sub

Sub WriteToITH(WGT, unit)

 txtTHQTY = IIf(IsNumeric(txtTHQTY), txtTHQTY, 0)
 txtTHWGT = IIf(IsNumeric(txtTHWGT), txtTHWGT, 0)
    
If Val(txtTHQTY) = 0 And Val(txtTHWGT) = 0 Then
   MsgBox "Quantity or Weight must be >0 "
   Exit Sub
End If

'Lay so THTSQ
txtTHTSQ = GetTSQ(txtTHITN)
Dim recITH As Recordset
Set recITH = DBconn.Execute("Select * from ITH Order by THTID DESC")
If recITH.EOF Then
    txtTHTID = 1
Else
    txtTHTID = recITH!THTID + 1
End If
recITH.Close

txtTHDTE = Format(txtTHDTE, "yyyy-mm-dd hh:mm:ss")
 sql = "Insert into ITH (THITN,THTSQ,THTID,THDOC,THTTC,THDTE" & _
 ",THWHC,THLTN,THQTY,THWGT,THCST" & _
 ",THCVN,THREF,THREM,THLUS,THLDT) values " & _
 "('" & txtTHITN & "'," & txtTHTSQ & "," & txtTHTID & ",'" & txtTHDOC & "','" & txtTHTTC & "','" & txtTHDTE & "'" & _
 ",'" & txtTHWHC & "','" & txtTHLTN & "'," & unit & "," & WGT & "," & txtTHCST & ",'" & txtTHCVN & "'" & _
 ",'" & txtTHREF & "','" & txtTHREM & "','" & UserLogin & "','" & Format(Now(), "yyyy-mm-dd hh:mm:ss") & "')"
 ' MsgBox SQL
 DBconn.Execute sql

Adodc1.Refresh
End Sub
Sub WriteToPOL(PON, ITN, WGT, QTY)

DBconn.Execute ("Update POL set OLRCQ= OLRCQ + " & QTY & ",OLRCW= OLRCW + " & WGT & _
" where OLPON='" & PON & "' AND OLITN='" & ITN & "' ")

End Sub

Private Sub grdITH_Click()
txtTHDOC = grdITH.Columns(2)
txtTHTID = grdITH.Columns(1)
WriteToScreen
Adodc1.Recordset.AbsolutePosition = SELECTROW
NewTrans = False
ISADDING = False
ISEDITING = False
ButtonStatus
End Sub

Private Sub grdITH_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    SELECTROW = Adodc1.Recordset.Bookmark
    If SELECTROW = "" Then SELECTROW = 1
End Sub

Private Sub txtTHCVN_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    Dim Result As String
    If Find("ITC", "TCDSC", " Where TCTTC='" & txtTHTTC & "' and TCEFR<>0 ") <> "" Then
        Result = Find("AVM", "VMNME", "WHERE VMVDN='" & txtTHCVN & "'")
        If Result = "" Then
            cboTHCVN.Visible = True
            cboTHCVN.SetFocus
        Else
            txtName = Result
            If txtTHREF.Visible Then
                txtTHREF.SetFocus
            Else
                txtTHQTY.SetFocus
            End If

        End If
    Else
        Result = Find("RCM", "CMNME", "WHERE CMCNO='" & txtTHCVN & "'")
        If Result = "" Then
            cboTHCVN.Visible = True
            cboTHCVN.SetFocus
        Else
            txtName = Result
            If txtTHREF.Visible Then
                txtTHREF.SetFocus
            Else
                txtTHQTY.SetFocus
            End If
        End If
    End If
End If

End Sub

Private Sub txtTHDOC_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Result = Find("ITH", "THTID", "WHERE THDOC='" & txtTHDOC & "'")
    If Result = "" Then
        txtTHDTE.SetFocus
    Else
        txtTHTID = Result
        MsgBox "Doc Number is already exist"
        NewTrans = False
        ISADDING = False
        ISEDITING = False
        WriteToScreen
        ButtonStatus
    End If
End If
End Sub

Private Sub txtTHDTE_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtTHWHC.SetFocus
End Sub

Private Sub txtTHITN_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    Dim Result As String
    Result = Find("IIM", "IMITD", "WHERE IMITN='" & txtTHITN & "'")
    
    If Result = "" Then
        cboTHITN.Visible = True
        cboTHITN.SetFocus
    Else
        FieldDel = "LMRID"
        DelStatus = "LZ"
        sql = "select LMLOT from ILM where " & FieldDel & " <>'" & DelStatus & "'  AND LMITN='" & txtTHITN & "' Group by LMLOT"
        Adodc7.ConnectionString = ConnectString
        Adodc7.ConnectionTimeout = 10
        Adodc7.CommandType = adCmdText
        Adodc7.RecordSource = sql
   ' MsgBox SQL
        Adodc7.Refresh
        If txtTHREF.Visible Then 'Have PO
            Adodc6.RecordSource = "Select OLPON from POL Where OLITN='" & txtTHITN & "' AND OLSTT <> '7' group by OLPON"
            Adodc6.Refresh
        End If
        txtIMITD = Result
        cboTHITN.Visible = False
        txtTHLTN.SetFocus
    End If
    
   
End If
End Sub
Sub OpenFile()

Adodc1.ConnectionString = ConnectString
Adodc1.ConnectionTimeout = 10
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "SELECT ITH.*,RCM.CMNME As Name ,Users.Name as UserName, IIM.IMITD " & _
    " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
    " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
    " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
    " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
    " Users.UserName = ITH.THLUS" & _
    " WHERE THDOC='" & txtTHDOC & "' Order by THTID"
Adodc1.Refresh

Adodc2.ConnectionString = ConnectString
Adodc2.ConnectionTimeout = 10
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "Select * From IWM where WHCID='" & COMPANYID & "'"
Adodc2.Refresh

Adodc3.ConnectionString = ConnectString
Adodc3.ConnectionTimeout = 10
Adodc3.CommandType = adCmdText
FieldDel = "IMRID"
DelStatus = "IZ"
Adodc3.RecordSource = "select IMITN, IMITN + ' ' + IMITD as IMITD from IIM where " & FieldDel & " <>'" & DelStatus & "'"
Adodc3.Refresh

Adodc4.ConnectionString = ConnectString
Adodc4.ConnectionTimeout = 10
Adodc4.CommandType = adCmdText
FieldDel = "CMRID"
DelStatus = "CZ"
Adodc4.RecordSource = "Select * from RCM where " & FieldDel & " <>'" & DelStatus & "'"
Adodc4.Refresh

Adodc5.ConnectionString = ConnectString
Adodc5.ConnectionTimeout = 10
Adodc5.CommandType = adCmdTable
Adodc5.RecordSource = "ITC"
Adodc5.Refresh

Adodc6.ConnectionString = ConnectString
Adodc6.ConnectionTimeout = 10
Adodc6.CommandType = adCmdText
Adodc6.RecordSource = "Select OLPON from POL group by OLPON"
Adodc6.Refresh


End Sub

Private Sub txtTHLTN_KeyPress(KeyAscii As Integer)
Dim Result As String
If KeyAscii = 13 Then
    Result = Find("ILM", "LMLOT", "WHERE LMLOT='" & txtTHLTN & "'")
    
    If Result = "" Then
        Response = MsgBox("This LotNo doesn't exist.Do You want to add new LotNo?", vbYesNo + vbCritical + vbDefaultButton2, "Chu y'")
        If Response = vbYes Then
            frmINV120.Show 1
        Else
            cboTHLTN.Visible = True
            
            If txtTHCVN.Visible Then
                txtTHCVN.SetFocus
            Else
                txtTHQTY.SetFocus
            End If
        End If
    End If
    If txtTHCVN.Visible Then
        txtTHCVN.SetFocus
    Else
        txtTHQTY.SetFocus
    End If
End If
End Sub

Private Sub txtTHQTY_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtTHWGT.SetFocus
End Sub

Private Sub txtTHREF_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Find("ITC", "TCDSC", " Where TCTTC='" & txtTHTTC & "' and TCEFR<>0") <> "" Then
        Result = Find("POL", "OLPON", "WHERE OLPON='" & txtTHREF & "'")
        If Result = "" Then
            cboTHREF.Visible = True
            cboTHREF.SetFocus
        Else
            txtTHREF = Result
            txtTHQTY.SetFocus
        End If
    Else
        txtTHREF = ""
    End If
    
End If
End Sub

Private Sub txtTHTTC_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    txtTHTTC = UCase(txtTHTTC)
    Dim RecITC As Recordset
    Set RecITC = DBconn.Execute("Select * from ITC where TCTTC='" & txtTHTTC & "'")
    If RecITC.EOF Then
        RecITC.Close
        cboTHTTC.Visible = True
    Else
        txtTCDSC = RecITC!TCDSC
        If RecITC!TCEFR Then
            Adodc4.ConnectionString = ConnectString
            Adodc4.ConnectionTimeout = 10
            Adodc4.CommandType = adCmdText
            FieldDel = "VMRID"
            DelStatus = "VZ"
            Adodc4.RecordSource = "Select * from AVM where " & FieldDel & " <>'" & DelStatus & "'"
            Adodc4.Refresh
            cboTHCVN.BoundColumn = "VMVDN"
            cboTHCVN.ListField = "VMNME"
            Adodc1.RecordSource = "SELECT ITH.*,AVM.VMNME As Name ,Users.Name as UserName, IIM.IMITD " & _
                " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
                " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
                " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
                " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
                " Users.UserName = ITH.THLUS" & _
                " WHERE THDOC='" & txtTHDOC & "' Order by THTID"
            Adodc1.Refresh
        Else
            Adodc4.ConnectionString = ConnectString
            Adodc4.ConnectionTimeout = 10
            Adodc4.CommandType = adCmdText
             FieldDel = "CMRID"
            DelStatus = "CZ"
            Adodc4.RecordSource = "Select * from RCM where " & FieldDel & " <>'" & DelStatus & "'"
            Adodc4.Refresh
            Adodc4.Refresh
            cboTHCVN.BoundColumn = "CMCNO"
            cboTHCVN.ListField = "CMNME"
            Adodc1.RecordSource = "SELECT ITH.*,RCM.CMNME As Name ,Users.Name as UserName, IIM.IMITD " & _
                " FROM Users RIGHT OUTER JOIN ITH INNER JOIN " & _
                " IIM ON ITH.THITN = IIM.IMITN LEFT OUTER JOIN " & _
                " AVM ON ITH.THCVN = AVM.VMVDN LEFT OUTER JOIN " & _
                " RCM ON ITH.THCVN = RCM.CMCNO ON " & _
                " Users.UserName = ITH.THLUS" & _
                " WHERE THDOC='" & txtTHDOC & "' Order by THTID"
            Adodc1.Refresh
        End If
        RecITC.Close
        If txtTHITN.Enabled Then txtTHITN.SetFocus
    End If
    
End If
End Sub

Private Sub txtTHWGT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If txtTHCST.Visible Then
        txtTHCST.SetFocus
    Else
        txtTHREM.SetFocus
    End If
End If
End Sub

Private Sub txtTHWHC_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
    Dim Result As String
    Result = Find("IWM", "WMDSC", "WHERE WMWHC='" & txtTHWHC & "'")
    If Result = "" Then
        cboTHWHC.Visible = True
        cboTHWHC.SetFocus
    Else
        txtWMDSC = Result
        cboTHWHC.Visible = False
        txtTHTTC.SetFocus
    End If
    
End If
End Sub

Sub ButtonStatus()

cmdAddnew.Enabled = Not ISEDITING
cmdReview.Enabled = Not ISEDITING
cmdNewItem.Enabled = Not ISEDITING
'cmdEdit.Enabled = Not ISEDITING
cmdSave.Enabled = ISEDITING
CmdCancel.Enabled = ISEDITING
FrameTransaction.Enabled = NewTrans
FrameItemTransactionDetail.Enabled = ISEDITING
End Sub

Sub WriteToFile()
Dim RecEffect As Recordset, WgtAdjust, UntAdjust As Double


Set RecEffect = DBconn.Execute("Select * from ITC where TCTTC='" & txtTHTTC & "'")
' Effect cost
If RecEffect!TCEFC Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, txtTHCST, "EffectCost"
End If
'If RecEffect!TCCYN Then
'    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, txtTHCST, "CostEntry"
'End If
'///////////////////////////
'EFFECT ON OPEN BALANCE
'///////////////////////////
If RecEffect!TCEFO Then
    Dim RecIIM As Recordset
    Set RecIIM = DBconn.Execute("Select * from IIM  Where IMITN='" & txtTHITN & "'")
    With RecIIM
        WgtAdjust = Val(txtTHWGT) - !IMOBW
        UntAdjust = Val(txtTHQTY) - !IMOBU
        WriteToITH WgtAdjust, UntAdjust
        .Close
    End With
    WriteToFileIIM txtTHITN, WgtAdjust, UntAdjust, 0, "Opened"
    WriteToIWI txtTHITN, txtTHWHC, WgtAdjust, UntAdjust, "Opened"
    WriteToILI txtTHITN, txtTHWHC, txtTHLTN, WgtAdjust, UntAdjust, "Opened"
Else
    WriteToITH txtTHWGT, txtTHQTY
End If
'EFFECT RECEIVED
If RecEffect!TCEFR Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, 0, "Recieved"
    WriteToIWI txtTHITN, txtTHWHC, txtTHWGT, txtTHQTY, "Recieved"
    WriteToILI txtTHITN, txtTHWHC, txtTHLTN, txtTHWGT, txtTHQTY, "Recieved"
    WriteToPOL txtTHREF, txtTHITN, txtTHWGT, txtTHQTY
End If
'EFFECT SOLD
If RecEffect!TCEFS Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, 0, "Sale"
    WriteToIWI txtTHITN, txtTHWHC, txtTHWGT, txtTHQTY, "Sale"
    WriteToILI txtTHITN, txtTHWHC, txtTHLTN, txtTHWGT, txtTHQTY, "Sale"
End If
'EFFECT ISSUED
If RecEffect!TCEFI Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, 0, "Issued"
    WriteToIWI txtTHITN, txtTHWHC, txtTHWGT, txtTHQTY, "Issued"
    WriteToILI txtTHITN, txtTHWHC, txtTHLTN, txtTHWGT, txtTHQTY, "Issued"
End If
'EFFECT ADJUST
If RecEffect!TCEFA Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, 0, "Adjusted"
    WriteToIWI txtTHITN, txtTHWHC, txtTHWGT, txtTHQTY, "Adjusted"
    WriteToILI txtTHITN, txtTHWHC, txtTHLTN, txtTHWGT, txtTHQTY, "Adjusted"
End If
' EFFECT ON ORDER
If RecEffect!TCEFP Then
    WriteToFileIIM txtTHITN, txtTHWGT, txtTHQTY, 0, "OnOrder"
End If


RecEffect.Close
Adodc1.Refresh
End Sub
Function ValidInput()
Dim StringErr As String
StringErr = ""
'Kiem tra txtTHTTC
    txtTHTTC = UCase(txtTHTTC)
    Dim RecITC As Recordset
    Set RecITC = DBconn.Execute("Select * from ITC where TCTTC='" & txtTHTTC & "'")
    If RecITC.EOF Then
        StringErr = StringErr & "* Invalid Transaction code"
    Else
        'Kiem tra nhap Wgt and QTY
        txtTHQTY = IIf(IsNumeric(txtTHQTY), txtTHQTY, 0)
        txtTHWGT = IIf(IsNumeric(txtTHWGT), txtTHWGT, 0)
        If IsNull(txtTHQTY) Or IsNull(txtTHWGT) Then StringErr = StringErr & Chr(13) & "- Not yet input Weight or Quantity"
        'Kiem tra docNo
        If txtTHDOC = "" Then StringErr = StringErr & Chr(13) & "- Not let Doc No blank"
        'Kiem tra Date
        Dim RecACN As Recordset
        Set RecACN = DBconn.Execute("Select * from ACN where CNTID='" & COMPANYTAX & "'")
        If RecACN!CNLCD > CDate(txtTHDTE) Then StringErr = StringErr & Chr(13) & "- Invalid date"
        'Kiem tra txtTHWHC
        If (Find("IWM", "WMDSC", "WHERE WMWHC='" & txtTHWHC & "'") = "") Then StringErr = StringErr & Chr(13) & "- Invalid Warehouse code"
        'Kiem tra txtTHITN
        If Find("IIM", "IMITD", "WHERE IMITN='" & txtTHITN & "'") = "" Then StringErr = StringErr & Chr(13) & "- Invalid Item Master code"
        'Kiemtra Lot bat buoc nhap neu IMLot=true
        If Find("IIM", "IMLOT", "WHERE IMITN='" & txtTHITN & "'") <> 0 Then
            If Find("ILM", "LMLOT", "WHERE LMLOT='" & txtTHLTN & "'") = "" Then StringErr = StringErr & Chr(13) & "- Invalid Lot No."
        Else
            If txtTHLTN <> "" Then StringErr = StringErr & Chr(13) & "- Noneed input Lot No."
        End If
        'Kiem tra code Cust/Vendor
        If RecITC!TCEFR And RecITC!TCEFC Then
            If Find("AVM", "VMNME", "WHERE VMVDN='" & txtTHCVN & "'") = "" Then StringErr = StringErr & Chr(13) & "- Invalid Vendor No."
            'Kiemtra so PO
            If Find("POL", "OLPON", "WHERE OLPON='" & txtTHREF & "'") = "" Then
                StringErr = StringErr & Chr(13) & "- Invalid PO."
            Else
                If Find("POL", "OLITN", "WHERE OLPON='" & txtTHREF & "' AND OLITN='" & txtTHITN & "' AND OLRID<>'LZ'") = "" Then
                    StringErr = StringErr & Chr(13) & "- This PO not order this Item."
                End If
            End If
        End If
        If RecITC!TCEFS Then
            If Find("RCM", "CMNME", "WHERE CMCNO='" & txtTHCVN & "'") = "" Then StringErr = StringErr & Chr(13) & "- Invalid Cust No."
        End If
        'Kiem tra nhap cost neu Effect costEntry<>0
        txtTHCST = IIf(IsNumeric(txtTHCST), txtTHCST, 0)
        If RecITC!TCCYN Then
            If Val(txtTHCST) = 0 Then StringErr = StringErr & Chr(13) & "- Not yet input cost."
        End If
    End If
If StringErr <> "" Then MsgBox StringErr
ValidInput = (StringErr = "")
End Function

